package com.cn.demo5;

import java.io.File;

/**
 * 获取当前类的类加载路径
 */
public class Cat {
    public String getClassPath(){
        File file = new File(this.getClass().getResource("/").getPath());
        return file.toString();
    }

    public static void main(String[] args) {
        Cat cat = new Cat();
        String classPath = cat.getClassPath();
        System.out.println(classPath);
    }
}
